package com.kcwl.carrier.domain.service;

import com.kcwl.carrier.domain.repository.ICarrierCollectionRepository;
import com.kcwl.carrier.infrastructure.repository.po.CarrierCollectionCompanyInfoPO;
import com.kcwl.carrier.interfaces.command.CarrierCompanyCommand;
import com.kcwl.carrier.interfaces.dto.CarrierCollectionCompanyInfoDTO;
import com.kcwl.carrier.interfaces.query.CarrierCompanyQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 张志强
 * 货主收藏
 */
@Service
public class CarrierCollectionDomainService {
    @Autowired
    private ICarrierCollectionRepository carrierCollectionRepository;

    public CarrierCollectionCompanyInfoPO getCarrierCompany(CarrierCompanyQuery query){
        return carrierCollectionRepository.getCarrierCompany(query);
    }

    /**
     * 新增
     */
    public int addCarrierCompany(CarrierCompanyCommand command){
        return carrierCollectionRepository.addCarrierCompany(command);
    }

    /**
     * 更新
     * @param command
     */
    public int updateCarrierCompany(CarrierCompanyCommand command){
        return carrierCollectionRepository.updateCarrierCompany(command);
    }

    /**
     * 取消货主收藏
     * @param query
     * @return
     */
    public List<CarrierCollectionCompanyInfoDTO> getCollectShippers(CarrierCompanyQuery query){
        return carrierCollectionRepository.getCollectShippers(query);
    }

    /**
     * 查询货主收藏数量
     * @param query
     * @return
     */
    public int getCollectCount(CarrierCompanyQuery query){
        return carrierCollectionRepository.getCollectCount(query);
    }
}
